from celery import Celery
from core.config import settings
# from tasks import test
# Redis 作为 broker 和 backend
celery = Celery(
    "worker",
    broker=settings.CELERY_BROKER_URL,
    backend=settings.CELERY_BROKER_URL,
    include=["tasks.test"]
)

# 定时任务配置
celery.conf.beat_schedule = {
    "say-hello-every-10-seconds": {
        "task": "tasks.test.say_hello",
        "schedule": 1000.0,  # 每 10 秒执行一次
        # "schedule": crontab(minute="*/1"),  # 每分钟执行一次
    },
}
celery.conf.timezone = "UTC"
